<template>
	<uni-card class="my-exer-page" :is-full="true" spacing="0">
		<xm-question
		  :type="question.type"
		  :markType="question.markType"
		  :title="question.title"
		  :score="question.score"
		  :answers="question.answers"
		  :userScore="question.userScore"
		  :options="question.options"
		  :editable="false"
		  :errMark="false"
		  :answersShow="true"
		></xm-question>
		<text class="question-type">{{question.questionTypeName}}</text>
	</uni-card>
</template>

<script lang="ts" setup>
import { ref, reactive } from "vue";
import XmQuestion from "@/components/xm-question/xm-questionExerSearch.vue";
import { onLoad } from "@dcloudio/uni-app";
import { Question } from "@/ts";
import http from "@/utils/request";

const question=reactive({
	questionTypeName:'',
	type:0,
	markType:0,
	title:'',
	score:0,
	answers:0,
	userScore:0,
	options:null,
})

// 页面加载完毕，执行如下方法
onLoad(async (option) => {
	question.questionTypeName=option.questionTypeName;
	uni.showToast({
		title: '加载中……',
		icon: 'loading',
		duration: 300
	})
	const { code, data } = await http.post("search/getQuestion", {
	"questionId":option.questionId
	});
	if (code !== 200) {
	return;
	}
	question.type=data.type;
	question.markType=data.markType;
	question.title=data.title;
	question.score=data.score;
	question.answers=data.answers;
	question.userScore=data.userScore;
	question.options=data.options;
	console.log(question)
});



</script>

<style>
	.question-type{
		margin: 10rpx;
		display: flex;
		justify-content: right;
		font-size: 25rpx;
		color: gray;
	}
</style>